<script type="text/javascript">
	$(document).ready(function(){
		$("#textarea").htmlarea({
                toolbar: ["html", "|",
                        "forecolor",  // <-- Add the "forecolor" Toolbar Button
                        "|", "bold", "italic", "underline", "|", "p", "h1", "h2", "h3", "|", "link", "unlink"] // Overrides/Specifies the Toolbar buttons to show
		});
		$("#PostAddProject").validate({ 
	        rules: { 
              "tieude":"required",
              "noidung":"required",
              "diachi":"required",
              "loban":"required",
	        }, 
	        messages: { 
              "tieude": "Nhập tiêu đề bài viết",
              "noidung": "Nhập nội dung bài viết",
              "diachi": "Nhập địa chỉ",
              "loban": "Nhập lô bán",
	        } 
		});
	});	
</script>

<div class="box">
	<!-- Box Head -->
	<div class="box-head">
		<h2>Sửa thông tin dự án</h2>
	</div>
	<!-- End Box Head -->
	
	<form id="PostAddProject" method="post" enctype="multipart/form-data" action="<?php echo $this->webroot;?>/duans/admin_edit">
		
		<!-- Form -->
		<div class="form">
				<input type="hidden" name="hinhdd" value="<?php echo $duan['Duan']['hinhdaidien'];?>" />
				<input type="hidden" name="id" value="<?php echo $duan['Duan']['id'];?>" />
				<p>
					<label>Tên dự án: <span class="require-field">(*)</span></label>
					<input class="field size1" value="<?php echo $duan['Duan']['tieude'];?>" type="text" name="tieude" class="field size1" />
				</p>
				<p>
					<label>Nội dung: <span class="require-field">(*)</span></label>
					<textarea id="textarea" class="field size1"  rows="10" cols="30" name="noidung"><?php echo $duan['Duan']['noidung'];?></textarea>
				</p>
				<p>
					<label>Hình đại diện: <span class="require-field">(*)</span></label>
					<img width="100" height="100" src="<?php echo $this->webroot;?>app/webroot/upload/<?php echo $duan['Duan']['hinhdaidien'];?>" alt="<?php echo $duan['Duan']['tieude'];?>" title="<?php echo $duan['Duan']['tieude'];?>"/>				
					<input type="file" name="hinhdaidien" class="field size1 hinhanhdaidien" style="float: left; width: 825px; margin-left: 20px"/>
				</p>
				<p>
					<label>Địa chỉ: <span class="require-field">(*)</span></label>
					<input class="field size1"  type="text" name="diachi" value="<?php echo $duan['Duan']['diachi'];?>" class="field size1" />
				</p>
				<p>
					<label>Phân loại:</label>
					<select name="phanloai">
						<?php
							for($i=0; $i<=1; $i++){
								if($i==$duan['Duan']['phanloai']){
									if($i==1){
										echo '<option selected value="'.$i.'">Dự án vip</option>';
									}else{
										echo '<option selected value="'.$i.'">Dự án thường</option>';
									}
								}else{
									if($i==1){
										echo '<option value="'.$i.'">Dự án vip</option>';
									}else{
										echo '<option value="'.$i.'">Dự án thường</option>';
									}
								}
							}
						?>
					</select>
				</p>
				<p>
					<label>Lô bán:<span class="require-field">(*)</span></label>
					<input class="field size1" value="<?php echo $duan['Duan']['loban'];?>"  type="text" name="loban" class="field size1" />
				</p>
				<p>
					<label>Vị trí xuất hiện:</label>
					<select name="vitrixh">
						<?php
							for($i=1; $i<=10; $i++){
								if($i==$duan['Duan']['vitrixh']){
									echo '<option selected value="'.$i.'">'.$i.'</option>';
								}else{
									echo '<option value="'.$i.'">'.$i.'</option>';
								}
							}
						?>
						
					</select>
				</p>	
					
			
		</div>
		<!-- End Form -->
		
		<!-- Form Buttons -->
		<div class="buttons">
			<input type="submit" class="button" value="Chỉnh sửa" />
		</div>
		<!-- End Form Buttons -->
	</form>
</div>